package com.yiyi.credit.manage.abutment.service;

import com.yiyi.credit.manage.model.vo.UserInfoVo;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

import java.util.Map;


@Service
public class UserService {

    @Autowired
    private RedisTemplate<Object, Object> redisTemplate;


    public UserInfoVo getUserInfo(String token) {
        if (StringUtils.isBlank(token)) {
            return null;
        }
        Map map = (Map) redisTemplate.opsForValue().get("credit" + token);
        if (map == null) {
            return null;
        }
        return (UserInfoVo) map.get("userInfoVo");
    }
}
